﻿using System;
using System.Data.SqlClient;
using Devv.Core.UniDataTier;

namespace Yglu.BusinessLayer.Entities
{
	public class ReadyCombo : BaseEntity
	{
		#region Properties

		public String Title { get; set; }

		public ProductCollection Products { get; set; }

		#endregion

		#region Constructor

		public ReadyCombo()
		{
			Products = new ProductCollection();
		}

		public ReadyCombo(Int32 id)
		{
			Construct(DataAccess.Product_Get(id));
		}

		public ReadyCombo(SqlDataReader reader)
		{
			Construct(reader);
		}

		#endregion

		#region Methods

		public override void Load(SqlDataReader reader)
		{
			Id = DataHandler.GetInt32(reader, "ReadyComboId");
			Title = DataHandler.GetString(reader, "ReadyComboTitle");
			Active = DataHandler.GetBoolean(reader, "ReadyComboActive");

			Products = new ProductCollection(DataAccess.Product_Get(this));
		}

		#endregion
	}
}